home *** CD-ROM | disk | FTP | other *** search
/ Die Ultimative Software-P…i Collection 1996 & 1997 / Die Ultimative Software-Pakete CD-ROM fur Atari Collection 1996 & 1997.iso / p / pofo / sprachen / pbasic / pbas21 / days.bas < prev    next >
Encoding:
BASIC Source File  |  1991-08-22  |  910 b   |  36 lines

  1.   rem fixed date calculations for january
  2.   rem changed x,y corrdinates for 2.1
  3.   cls
  4.   dim m(12)
  5.   ' days in each month
  6.   m(1)=31:m(2)=28:m(3)=31:m(4)=30
  7.   m(5)=31:m(6)=30:m(7)=31:m(8)=31
  8.   m(9)=30:m(10)=31:m(11)=30:m(12)=31
  9.   print "Enter First Date"
  10.   r=2:c=1
  11.   gosub 1000  ' get the first date
  12.   d1 = d
  13.   locate 1,21:print "Enter Second Date"
  14.   r=2:c=21
  15.   gosub 1000  ' get the second date
  16.   d2 = d
  17.   diff = abs(d2-d1) ' number of days
  18.   box 4,1,6,40,1
  19.   locate 5,10:print "Number of days : " diff
  20.   end
  21.  
  22. 1000 ' read in date, convert to days
  23.      ' in D   
  24.    locate r,c:input "Month";month
  25.    locate r+1,c:input "Day  ";day
  26.    locate r+2,c:input "Year ";year
  27.    if (year%4)=0 then m(2)=29 else m(2)=28
  28.    d = 0
  29.    ' get number of days this year
  30.    for x = 1 to month-1
  31.       d = d + m(x)
  32.    next x
  33.    if month = 1 then d = 0
  34.    d = d + int(year*365.25) + day
  35.    return
  36. ə